From: Adel Gadllah Date: Mon, 18 Feb 2013 18:26:13 +0000 (+0100) Subject: Minimize fullscreen windows when they end up in the background X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4783 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=049695b9147627232d2e431ef25b51672ad40091;p=gnome-shell.git Minimize fullscreen windows when they end up in the background Alt-Tab away from a monitor sized on the primary monitor results into the top panel being displayed on top of the window which looks very bad. So just hide those windows by minimizing them. The icon geometry animation does not really make sense for fullscreen windows so just fade them out. https://bugzilla.gnome.org/show_bug.cgi?id=693991 --- diff --git a/js/ui/layout.js b/js/ui/layout.js index 0e69dfc21..f794b1079 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -816,6 +816,23 @@ const LayoutManager = new Lang.Class({ } if (primaryWasInFullscreen != this.primaryMonitor.inFullscreen) { + let windows = this._getWindowActorsForWorkspace(global.screen.get_active_workspace()); + for (let i = 0; i < windows.length - 1; i++) { + let window = windows[i]; + let metaWindow = window.meta_window; + + // Skip minimized windows + if (!metaWindow.showing_on_its_workspace()) + continue; + + // Skip windows that aren't on the primary monitor + if (!metaWindow.is_on_primary_monitor()) + continue; + + // Minimize monitor sized windows + if (metaWindow.is_monitor_sized()) + metaWindow.minimize(); + } this.emit('primary-fullscreen-changed', this.primaryMonitor.inFullscreen); } }, diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index b51f942cc..8b8870ea5 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -245,28 +245,9 @@ const WindowManager = new Lang.Class({ this._minimizing.push(actor); - let xDest, yDest, xScale, yScale; - let [success, geom] = actor.meta_window.get_icon_geometry(); - if (success) { - xDest = geom.x; - yDest = geom.y; - xScale = geom.width / actor.width; - yScale = geom.height / actor.height; - } else { - let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()]; - xDest = monitor.x; - yDest = monitor.y; - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) - xDest += monitor.width; - xScale = 0; - yScale = 0; - } - - Tweener.addTween(actor, - { scale_x: xScale, - scale_y: yScale, - x: xDest, - y: yDest, + if (actor.meta_window.is_monitor_sized()) { + Tweener.addTween(actor, + { opacity: 0, time: WINDOW_ANIMATION_TIME, transition: 'easeOutQuad', onComplete: this._minimizeWindowDone, @@ -276,12 +257,46 @@ const WindowManager = new Lang.Class({ onOverwriteScope: this, onOverwriteParams: [shellwm, actor] }); + } else { + let xDest, yDest, xScale, yScale; + let [success, geom] = actor.meta_window.get_icon_geometry(); + if (success) { + xDest = geom.x; + yDest = geom.y; + xScale = geom.width / actor.width; + yScale = geom.height / actor.height; + } else { + let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()]; + xDest = monitor.x; + yDest = monitor.y; + if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) + xDest += monitor.width; + xScale = 0; + yScale = 0; + } + + Tweener.addTween(actor, + { scale_x: xScale, + scale_y: yScale, + x: xDest, + y: yDest, + time: WINDOW_ANIMATION_TIME, + transition: 'easeOutQuad', + onComplete: this._minimizeWindowDone, + onCompleteScope: this, + onCompleteParams: [shellwm, actor], + onOverwrite: this._minimizeWindowOverwritten, + onOverwriteScope: this, + onOverwriteParams: [shellwm, actor] + }); + } }, _minimizeWindowDone : function(shellwm, actor) { if (this._removeEffect(this._minimizing, actor)) { Tweener.removeTweens(actor); actor.set_scale(1.0, 1.0); + actor.set_opacity(255); actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST); shellwm.completed_minimize(actor);